﻿using System;
using good1.Core.Enums;
using NHibernate.Validator.Constraints;
using SharpArch.Core.DomainModel;

namespace good1.Core
{
    //[HasUniqueDomainSignature]
    public class User : Entity
    {
        private int goodRolesType = (int)GoodRoles.Donor;
        private Gender gender = Gender.Unknown;

        [Length(255)]
        //[DomainSignature]
        public virtual string Username { get; set; }
        //http://msmvps.com/blogs/luisabreu/archive/2008/12/08/s-arp-core-overview.aspx
        //http://msmvps.com/blogs/luisabreu/archive/2009/04/27/the-s-arp-framework-the-duplicator-validator.aspx

        [Length(255)]
        public virtual string EmailAddress { get; set; }
        
        [Length(100)]
        public virtual string PasswordHash { get; set; }

        [Length(100)]
        public virtual string PasswordSalt { get; set; }
 
        [Length(100)]
        public virtual string FirstName { get; set; }
        
        [Length(100)] 
        public virtual string LastName { get; set; }

        [Length(1)]
        public virtual Gender Gender { get { return gender; } set { gender = value; } }

        public virtual DateTime? Birthday { get; set; }
        
        [Length(50)] 
        public virtual string PasswordQuestion { get; set; }

        [Length(20)] 
        public virtual string PasswordAnswer { get; set; }

        public virtual bool IsApproved { get; set; }

        public virtual Guid ProviderUserKey { get; set; }

        //TODO add clientip address and an audit trail of login.

        public virtual int RolesBitwise { get; set; }

        public virtual int GoodRolesType { get{ return goodRolesType;} set{ goodRolesType = value;} }

        
    }
		
}
